﻿<Page
    x:Class="OsmcRemoteApp.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:OsmcRemoteApp"
    xmlns:converters="using:OsmcRemoteAppCommon.Converters"
    xmlns:ads="using:Microsoft.AdMediator.Universal"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    IsEnabled="{Binding IsConnected}"
    Loaded="PageOnLoaded">
    <Grid>
        <Grid.Resources>
            <converters:ConvectionIndicatorStatusToBrushConverter x:Key="ConvectionIndicatorStatusToBrushConverter"/>
            <Style TargetType="Button" x:Key="BigButton">
                <Setter Property="HorizontalAlignment" Value="Stretch"></Setter>
                <Setter Property="VerticalAlignment" Value="Stretch"></Setter>
                <Setter Property="Margin" Value="5"></Setter>
            </Style>
            <Style TargetType="Button" x:Key="SmallButton">
                <Setter Property="HorizontalAlignment" Value="Center"></Setter>
                <Setter Property="VerticalAlignment" Value="Center"></Setter>
            </Style>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <StackPanel Orientation="Vertical" Grid.Row="1" Grid.Column="2" VerticalAlignment="Center">
            <Border Name="PowerBorder" BorderThickness="3" BorderBrush="{Binding ConnectionIndicatorStatus, Converter={StaticResource ConvectionIndicatorStatusToBrushConverter}}" 
                    Width="{Binding SmallButtonWidth}" Height="{Binding SmallButtonHeight}" >
                <Button Content="Power" Name="PowerButton" Style="{StaticResource SmallButton}" Width="{Binding SmallButtonWidth}" Height="{Binding SmallButtonHeight}" Background="Red" Click="PowerButtonOnClick"></Button>
            </Border>
            <Button Content="Mute" Style="{StaticResource SmallButton}" Width="{Binding SmallButtonWidth}" Height="{Binding SmallButtonHeight}" Click="MuteButtonClick"></Button>
        </StackPanel>
        <StackPanel Orientation="Vertical" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center">
            <Button Content="+" Style="{StaticResource SmallButton}" Width="{Binding SmallButtonWidth}" Height="{Binding SmallButtonHeight}" FontFamily="Segoe UI Symbol" Click="VolumeUpOnClick"></Button>
            <Button Content="-" Style="{StaticResource SmallButton}" Width="{Binding SmallButtonWidth}" Height="{Binding SmallButtonHeight}" FontFamily="Segoe UI Symbol" Click="VolumeDownOnClick"></Button>
        </StackPanel>
        <Button Content="Back" Grid.Row="3" Grid.Column="0" Style="{StaticResource SmallButton}" Width="{Binding SmallButtonWidth}" Height="{Binding SmallButtonHeight}" Click="BackButtonOnClick"></Button>
        <Button Content="Home" Grid.Row="3" Grid.Column="2" Style="{StaticResource SmallButton}" Width="{Binding SmallButtonWidth}" Height="{Binding SmallButtonHeight}" Click="HomeButtonOnClick"></Button>
        <Button Content="&#xE08A;" FontFamily="Segoe UI Symbol" Grid.Row="1" Grid.Column="1" Style="{StaticResource BigButton}" Click="UpButtonOnClick"></Button>
        <Button Content="&#xE085;" FontFamily="Segoe UI Symbol" Grid.Row="2" Grid.Column="0" Style="{StaticResource BigButton}" Click="LeftButtonOnClick"></Button>
        <Button Content="OK" FontFamily="Segoe UI Symbol" Grid.Row="2" Grid.Column="1" Name="OkButton" SizeChanged="OkButtonSizeChanged" LayoutUpdated="OkButtonLayoutUpdated" Style="{StaticResource BigButton}" Click="OkButtonOnClick"></Button>
        <Button Content="&#xE086;" FontFamily="Segoe UI Symbol" Grid.Row="2" Grid.Column="2" Style="{StaticResource BigButton}" Click="RightButtonOnClick"></Button>
        <Button Content="&#xE08b;" FontFamily="Segoe UI Symbol" Grid.Row="3" Grid.Column="1" Style="{StaticResource BigButton}" Click="DownButtonOnClick"></Button>
        <StackPanel Orientation="Vertical" Grid.Row="4" Grid.Column="0" VerticalAlignment="Center">
            <Button Content="&lt;&lt;" Style="{StaticResource SmallButton}" Width="{Binding SmallButtonWidth}" Height="{Binding SmallButtonHeight}" IsEnabled="{Binding PlayersActive}" FontFamily="Segoe UI Symbol" Click="SetSpeedDecrementOnClick"></Button>
            <Button Content="|&lt;&lt;" Style="{StaticResource SmallButton}" Width="{Binding SmallButtonWidth}" Height="{Binding SmallButtonHeight}" IsEnabled="{Binding PlayersActive}" FontFamily="Segoe UI Symbol" Click="GoToPreviousOnClick"></Button>
        </StackPanel>
        <StackPanel Orientation="Vertical" Grid.Row="4" Grid.Column="2" VerticalAlignment="Center">
            <Button Content="&gt;&gt;" Style="{StaticResource SmallButton}" Width="{Binding SmallButtonWidth}" Height="{Binding SmallButtonHeight}" IsEnabled="{Binding PlayersActive}" FontFamily="Segoe UI Symbol" Click="SetSpeedIncrementOnClick"></Button>
            <Button Content="&gt;&gt;|" Style="{StaticResource SmallButton}" Width="{Binding SmallButtonWidth}" Height="{Binding SmallButtonHeight}" IsEnabled="{Binding PlayersActive}" FontFamily="Segoe UI Symbol" Click="GoToNextOnClick"></Button>
        </StackPanel>
        <StackPanel Orientation="Vertical" Grid.Row="4" Grid.Column="1" VerticalAlignment="Center">
            <Button Content="&#xE102;/&#xE103;" Style="{StaticResource SmallButton}" Width="{Binding SmallButtonWidth}" Height="{Binding SmallButtonHeight}" IsEnabled="{Binding PlayersActive}" FontFamily="Segoe UI Symbol" Click="PlayPauseOnClick"></Button>
            <Button Content="&#xE20D;" Style="{StaticResource SmallButton}" Width="{Binding SmallButtonWidth}" Height="{Binding SmallButtonHeight}" IsEnabled="{Binding PlayersActive}" FontFamily="Segoe UI Symbol" Click="StopOnClick"></Button>
        </StackPanel>
        <ads:AdMediatorControl Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"></ads:AdMediatorControl>
    </Grid>
    <Page.BottomAppBar>
        <CommandBar>
            <AppBarButton Label="Settings" Command="{Binding SettingsCommand}" CommandParameter="{Binding Path=., Source={RelativeSource Mode=Self}}">
                <AppBarButton.Icon>
                    <SymbolIcon Symbol="Setting"></SymbolIcon>
                </AppBarButton.Icon>
            </AppBarButton>
        </CommandBar>
    </Page.BottomAppBar>
</Page>
